﻿using EShop.Net.Model.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EShop.Net.IRepository.User
{
    public interface IUserRepository : IBaseRepository<UserInfo>
    {
        /// <summary>
        /// 商家端登录
        /// </summary>
        /// <param name="userName">账号</param>
        /// <param name="userPwd">密码</param>
        /// <returns>用户信息</returns>
        Task<UserInfo> AdminLogin(string userName, string userPwd);

        /// <summary>
        /// 查询用户根据OpenId
        /// </summary>
        /// <param name="openId">openId</param>
        /// <returns>实体数据</returns>
        Task<UserInfo> SelectUserByOpenId(string openId);

        /// <summary>
        /// 更新用户sessionKey，根据openid
        /// </summary>
        /// <param name="openid">openid</param>
        /// <param name="sessionKey">sessionKey</param>
        /// <param name="nickName">昵称</param>
        /// <param name="avatarImage">头像路径</param>
        /// <returns>成功或失败</returns>
        Task<bool> UpdateByUserOpenid(string openid, string sessionKey, string nickName, string avatarImage);

        /// <summary>
        /// 根据ID修改个人信息
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="birthday">生日</param>
        /// <param name="gender">性别</param>
        /// <param name="city">城市</param>
        /// <param name="province">省份</param>
        /// <param name="district">区</param>
        /// <param name="userPhoneEncrypt">经过加密的手机号</param>
        /// <returns>成功或失败</returns>
        Task<bool> UpdateUserInfoById(int id, DateTime birthday, int gender, string city, string province, string district, string userPhoneEncrypt);
    }
}
